import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // {
    //   path: '/',
    //   name: 'home',
    //   component: HomeView,
    // },
    // {
    //   path: '/about',
    //   name: 'about',
    //   // route level code-splitting
    //   // this generates a separate chunk (About.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   component: () => import('../views/AboutView.vue'),
    // },
    {
      path: '/',
      name: 'Login',
      component: () => import('../views/LoginView.vue'),
    },

    {
      path: '/Index',
      name: 'Index',

      component: () => import('../views/IndexView.vue'),
      children: [
        //RBAC管理
        {
          path: '/Permission',
          name: 'Permission',

          component: () => import('../views/RBACView/GetPermissionView.vue'),
        },
        {
          path: '/Role',
          name: 'Role',

          component: () => import('../views/RBACView/RoleView.vue'),
        },
        {
          path: '/User',
          name: 'User',

          component: () => import('../views/RBACView/UserView.vue'),
        },
        //溯源管理
        {
          path: '/Traceability',
          name: 'Traceability',

          component: () => import('../views/TraceabilityView/GetTraceabilityView.vue')
        },

        {
          path: '/TraceabilityEndit',
          name: 'TraceabilityEndit',

          component: () => import('../views/TraceabilityView/TraceabilityEnditView.vue')
        },

      ]
    },
    // 溯源码扫描后的详情页面 - 不需要登录即可访问
    {
      path: '/traceability-detail',
      name: 'TraceabilityDetail',
      component: () => import('../views/TraceabilityDetailView.vue')
    },
  ],
})

export default router
